package com.xuecheng.content.model.dto;

import com.xuecheng.base.exception.ValidatedGroups;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;

/**
 * @author 勾新杰
 * @version 1.0
 * @description: 新增课程基本信息的请求参数
 * @date 2024/12/18 16:11
 */
@Data
@ApiModel(description = "新增课程基本信息的请求参数")
public class SaveCourseBaseDTO { // 一般来说接收前端的请求参数的对象和返回前端的响应结果对象不需要实现序列化接口，他们会被WebMvc转化为json

    /**
     * 课程名称
     */
    @NotEmpty(message = "课程名称不能为空", groups = {ValidatedGroups.Insert.class})
    @ApiModelProperty(value = "课程名称", required = true)
    private String name;

    /**
     * 适用人群
     */
    @NotEmpty(message = "适用人群不能为空", groups = {ValidatedGroups.Insert.class})
    @Size(message = "适用人群内容过少", min = 10, groups = {ValidatedGroups.Insert.class, ValidatedGroups.Update.class})
    // 验证内容长度不少于10
    @ApiModelProperty(value = "适用人群", required = true)
    private String users;

    /**
     * 课程标签
     */
    @ApiModelProperty(value = "课程标签")
    private String tags;

    /**
     * 大分类
     */
    @NotEmpty(message = "课程分类不能为空", groups = {ValidatedGroups.Insert.class})
    @ApiModelProperty(value = "大分类", required = true)
    private String mt;

    /**
     * 小分类
     */
    @NotEmpty(message = "课程分类不能为空", groups = {ValidatedGroups.Insert.class})
    @ApiModelProperty(value = "小分类", required = true)
    private String st;

    /**
     * 课程等级
     */
    @NotEmpty(message = "课程等级不能为空", groups = {ValidatedGroups.Insert.class})
    @ApiModelProperty(value = "课程等级", required = true)
    private String grade;

    /**
     * 教育模式(common普通，record 录播，live直播等）
     */
    @NotEmpty(message = "教育模式不能为空", groups = {ValidatedGroups.Insert.class})
    @ApiModelProperty(value = "教学模式（普通，录播，直播等）", required = true)
    private String teachmode;

    /**
     * 课程介绍
     */
    @NotEmpty(message = "课程介绍不能为空", groups = {ValidatedGroups.Insert.class})
    @Size(message = "课程介绍内容过少", min = 10, groups = {ValidatedGroups.Insert.class, ValidatedGroups.Update.class})
    @ApiModelProperty(value = "课程介绍")
    private String description;

    /**
     * 课程图片
     */
    @NotEmpty(message = "课程图片不能为空", groups = {ValidatedGroups.Insert.class}) // 验证图片是否为空
    @ApiModelProperty(value = "课程图片", required = true)
    private String pic;

    /**
     * 收费规则，对应数据字典
     */
    @NotEmpty(message = "收费规则不能为空", groups = {ValidatedGroups.Insert.class})
    @ApiModelProperty(value = "收费规则，对应数据字典", required = true)
    private String charge;

    /**
     * 课程价格
     */
    @ApiModelProperty(value = "价格")
    private Float price; // 数值类型是有默认值的

    /**
     * 原价
     */
    @ApiModelProperty(value = "原价")
    private Float originalPrice; // 需要计算的时候转成BigDecimal

    /**
     * 咨询qq
     */
    @ApiModelProperty(value = "qq")
    private String qq;

    /**
     * 微信
     */
    @ApiModelProperty(value = "微信")
    private String wechat;

    /**
     * 电话
     */
    @NotEmpty(message = "电话不能为空", groups = {ValidatedGroups.Insert.class})
    @ApiModelProperty(value = "电话", required = true)
    private String phone;

    /**
     * 有效期天数
     */
    @NotNull(message = "有效期天数不能为空", groups = {ValidatedGroups.Insert.class})
    @ApiModelProperty(value = "有效期", required = true)
    private Integer validDays;
}
